package com.vitogiovanni.tobook.utilities;

import com.vitogiovanni.tobook.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class NavigationItemAdapter extends ArrayAdapter<NavigationItem> {
	public NavigationItemAdapter(Context context, int textViewResourceId,
            NavigationItem [] objects) {
        super(context, textViewResourceId, objects);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        LayoutInflater inflater = (LayoutInflater) getContext()
             .getSystemService(Context.LAYOUT_INFLATER_SERVICE);       
        convertView = inflater.inflate(R.layout.drawer_list_item, null);
        TextView nameItem = (TextView)convertView.findViewById(R.id.drawer_item_txt);
        ImageView imageItem = (ImageView)convertView.findViewById(R.id.drawer_item_img);
        NavigationItem elementoNavBar = getItem(position);
        nameItem.setText(elementoNavBar.getName());
        imageItem.setImageDrawable(elementoNavBar.getImage());
       // TextView nome = (TextView)convertView.findViewById(R.id.textViewName);
        //TextView numero = (TextView)convertView.findViewById(R.id.textViewNumber);
        return convertView;
    }

}
